<template>
    <v-snackbar :model-value="snackbarShow" :timeout="snackbarTimeout" @update:modelValue="clickBnt(false)">
        {{ snackbarText }}

        <template v-slot:actions>
            <v-btn color="blue" variant="text" @click="clickBnt(false)">
                Close
            </v-btn>
        </template>
    </v-snackbar>
</template>


<script lang="ts">
import { defineComponent, ref, provide } from 'vue'

export default defineComponent({
    name: 'sna',
    props: {
        snackbarShow: { type:Boolean },
        snackbarText: { type:String },
        snackbarTimeout: { type:Number }
    },
    setup(props, context) {
        const clickBnt = function (val:boolean) {
            console.info('传递值给父类')
            context.emit('update:snackbarShow', val)
            context.emit('update:snackbarText', '')
            context.emit('update:snackbarTimeout', '3000')
        }
        return { clickBnt }
    }
})
</script>